/*
 * 组件注释
 * @Author: machinist_wq
 * @Date: 2022-05-03 12:50:21
 * @LastEditors: machinist_wq
 * @LastEditTime: 2022-06-30 21:18:28
 * @Description: 全局loading
 * 人生无常！大肠包小肠......
 */
"use strict";
import { Spin } from "antd";
import { FC, ReactElement } from "react";
import styles from "./index.less";

interface Iprops {
  tip?: ReactElement | string;
  spinning: boolean | undefined;
  children?: ReactElement | string;
  style?: object;
}
const Index: FC<Iprops> = ({
  tip = "Loading...",
  spinning = false,
  children,
  style = {},
}: Iprops): ReactElement => {
  return children ? (
    <Spin tip={tip} spinning={spinning}>
      {children}
    </Spin>
  ) : (
    <div className={`${styles.spin} spin`} style={style}>
      <Spin tip={tip} />
    </div>
  );
};
export default Index;
